package com.erp.gather.controller;

import com.erp.gather.service.IErpPythonMethodCallService;
import com.ruoyi.common.core.domain.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/gather/pythonMethodCall")
public class ErpPythonMethodCallController {

    @Resource
    IErpPythonMethodCallService erpPythonMethodCallService;


    @GetMapping("/createActivityByPython/{storeId}/{startTime}/{endTime}/{activityName}")
    public R<Object> createActivityByPython(
            @PathVariable("storeId") String storeId,
            @PathVariable("startTime") String startTime,
            @PathVariable("endTime") String endTime,
            @PathVariable("activityName") String activityName
    ) {
        return erpPythonMethodCallService.createActivityByPython(storeId, startTime, endTime, activityName);
    }


    /**
     * 设置联盟折扣
     */
//    @GetMapping("/setCommission")
//    public R<Object> setCommission(Long storeId, Long aeProductId, Integer commission) {
//      return erpPythonMethodCallService.setCommission(storeId,aeProductId,commission);
//
//    }
    @GetMapping("/addProductToActivity/{storeId}/{discount}/{promotionId}/{productId}")
    R<Object> addProductToActivity(@PathVariable("storeId") String storeId,
                                   @PathVariable("discount") String discount,
                                   @PathVariable("promotionId") String promotionId,
                                   @PathVariable("productId") String productId) {
        return erpPythonMethodCallService.addProductToActivity(storeId, discount, promotionId, productId);
    }

    @GetMapping("/queryCookieByStoreId")
    R<Object> queryCookieByStoreId(String storeId) {
        return R.ok(erpPythonMethodCallService.queryCookieByStoreId(Long.valueOf(storeId)));
    }
}
